package com.jiayi.weiphoto.activity;

import java.io.File;
import java.io.InputStream;

import com.jiayi.weiphoto.net.DImge;

import android.app.Service;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.IBinder;


public class MusicServer extends Service {

	DImge di = null;

	@Override
	public void onCreate() {
		super.onCreate();
		di = new DImge(getApplicationContext());
	}

	@Override
	public int onStartCommand(Intent intent, int flags, int startId) {

//		for (int i = 0; i < MainActivity.imgs.length; i++) {
//			File f = new File(DImge.PATH + i);
//			if (!f.exists()) {
//				InputStream is = this.getResources().openRawResource(
//						MainActivity.imgs[i]);
//				Bitmap bt = BitmapFactory.decodeStream(is, null, null);
//				di.DisplayData(bt, i + "");
//			}
//		}

		return super.onStartCommand(intent, flags, startId);

	}

	@Override
	public void onDestroy() {
		SharedPreferences sp = getSharedPreferences("userinfo", MODE_PRIVATE);
		SharedPreferences.Editor editor = sp.edit();
		editor.putInt("id", 1);
		editor.commit();
		// fileCache.clear();
		super.onDestroy();
	}

	@Override
	public IBinder onBind(Intent intent) {
		// TODO Auto-generated method stub
		return null;
	}

}
